package com.yixiaobai.swimming.dao;

import com.yixiaobai.swimming.entity.Employer;
import com.yixiaobai.swimming.mapper.VEmplyerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.SQLException;

/**
 * @author yuyunlong
 * @date 2020/7/4 1:24 下午
 * @description
 */
@Service
public class EmployerDao {

    @Autowired
    private VEmplyerMapper vEmployerMapper;

    public Boolean insert(Employer employer) throws Exception {
        int result = vEmployerMapper.insert(employer);
        if (result < 0) {
            throw new SQLException("insert employ fail");
        }
        return true;
    }

    public Employer queryByUsername(String username) {
        return vEmployerMapper.queryByUsername(username);
    }

    public Employer queryByPhone(String phnoe) {
        return vEmployerMapper.queryByPhone(phnoe);
    }

    public Employer queryByUsernameAndPwd(String username, String password) {
        return vEmployerMapper.queryByUsernameAndPwd(username, password);
    }

    public Integer queryUtypeByAddUser(String addUser) {
        return vEmployerMapper.queryUtypeByAddUser(addUser);
    }

    public Integer deleteEmployerByDeleteUser(String deleteUser) {
        return vEmployerMapper.deleteEmployerByDeleteUser(deleteUser);
    }
}
